﻿using System;
using DocumentManager.Abstractions.Interfaces.Helpers;

namespace DocumentManager.Helpers
{
	public class PasswordGenerator : IPasswordGenerator
	{
		#region Constants

		private const string PASSWORD_TEMPLATE = @"{0}{1}";

		#endregion

		#region IPasswordGenerator Members

		public string GeneratePasswordByDate(DateTime dateTime)
		{
			var firstPassPart = string.Concat(dateTime.Month, dateTime.Year);
			var array = firstPassPart.ToCharArray();
			Array.Reverse(array);
			return string.Format(
				PASSWORD_TEMPLATE,
				firstPassPart,
				new string(array));
		}

		#endregion
	}
}
